#include <bits/stdc++.h>

using namespace std;

/**
 * Definition for a binary tree node.
 */
struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};

vector<int> rightSideView(TreeNode* root);
void dfs(TreeNode* root, int depth);

int main()
{
	return 0;
}

vector<int> res;
vector<int> rightSideView(TreeNode* root)
{
	dfs(root, 0);
	return res;
}

void dfs(TreeNode* root, int depth)
{
	if (!root) return;

	if (depth == res.size())
		res.emplace_back(root->val);

	depth++;
	dfs(root->right, depth);
	dfs(root->left, depth);
}
